<@pp.dropOutputFile/>
<#include "../common/util.ftl">
<#-- iterate table list-->
<#list doc.tables as table>

<#-- generate package name -->
<#assign app = doc.artifactid?replace(".", "/")>
<#assign package = table.moduleid?replace(".", "/")>
<#assign fileName = table.name?cap_first>
<@pp.changeOutputFile name = "/" + package  + "/" + fileName + "Service.vb"/>
<#compress>
<#list table.fields as field>
	<#assign typePackage = getTypePackage(field.type)>
	<#if typePackage?length != 0>Imports ${typePackage}</#if>
</#list>
</#compress>
Imports Stone.Common
Namespace ${package?replace("/", ".")}
    ''' <summary>
	''' ${fileName}服务层实现
    ''' ${table.comment}
    ''' </summary>
    ''' <remarks>${doc.version}</remarks>
	Public interface I${fileName}Service
        ''' <summary>
        ''' 创建${fileName}对象
        ''' </summary>
        ''' <param name="obj">新值</param>
        ''' <returns>操作结果(Data属性：新对象ID)</returns>
        Function create(obj As ${fileName}) As Outcome

        ''' <summary>
        ''' 批量创建${fileName}对象
        ''' </summary>
        ''' <param name="objs">新值列表</param>
        ''' <returns>操作结果(Data属性：***)</returns>
        Function createBatch(objs As List(Of ${fileName})) As Outcome

        ''' <summary>
        ''' 修改${fileName}对象，以ID为选择依据
        ''' </summary>
        ''' <param name="obj">新值</param>
        ''' <returns>操作结果(Data属性：影响行数)</returns>
        Function update(obj As ${fileName}) As Outcome

        ''' <summary>
        ''' 根据ID列表删除对象
        ''' </summary>
        ''' <param name="ids">ID列表</param>
        ''' <returns>操作结果(Data属性：影响行数)</returns>
        Function delete(ids As List(Of String)) As Outcome

        ''' <summary>
        ''' 根据ID删除对象
        ''' </summary>
        ''' <param name="ids">ID列表</param>
        ''' <returns>操作结果(Data属性：影响行数)</returns>
        Function delete(id As String) As Outcome
		
        ''' <summary>
        ''' 根据条件删除对象
        ''' </summary>
        ''' <param name="ids">ID列表</param>
        ''' <returns>操作结果(Data属性：影响行数)</returns>
        Function delete(params As Dictionary(Of String, Object)) As Outcome

        ''' <summary>
        ''' 获取记录数
        ''' </summary>
        ''' <returns>操作结果(Data属性：计数)</returns>
        Function size(params As Dictionary(Of String, Object)) As Outcome

        ''' <summary>
        ''' 获取分页数据
        ''' </summary>
        ''' <param name="page">页编码（从0开始）</param>
        ''' <param name="size">页大小</param>
        ''' <param name="params">查询参数</param>
        ''' <returns>操作结果(Data属性：查询到页数据列表，查询失败为空列表)</returns>
        Function getPage(page As Integer, size As Integer, params As Dictionary(Of String, Object)) As Outcome

        ''' <summary>
        ''' 获取单个对象，如果筛选条件返回多个对象，则选择第一个返回
        ''' </summary>
        ''' <param name="params">查询参数</param>
        ''' <returns>操作结果(Data属性：查询到的第一个记录，查询失败为Nothing)</returns>
        Function getOne(params As Dictionary(Of String, Object)) As Outcome

        ''' <summary>
        ''' 加载关联对象
        ''' </summary>
        ''' <param name="data"></param>
        ''' <remarks></remarks>
        Sub loadBuddies(ByRef data As ${fileName})

        ''' <summary>
        ''' 保存关联对象
        ''' </summary>
        ''' <param name="data"></param>
        ''' <remarks></remarks>
        Sub saveBuddies(ByRef data As ${fileName})

        ''' <summary>
        ''' 删除关联对象
        ''' </summary>
        ''' <param name="data"></param>
        ''' <remarks></remarks>
        Sub deleteBuddies(ByRef data As ${fileName})

		''' <summary>
        ''' 将数据导出至EXCEL
        ''' </summary>
        ''' <param name="data">数据集</param>
        ''' <param name="file">EXCEL全文件名</param>
        ''' <returns>操作结果</returns>
        ''' <remarks></remarks>
        Function toExcel(data As List(Of ${fileName}), file As String) As Outcome

	End Interface
End Namespace
</#list>